import 'package:flutter/material.dart';

///
class ButtonListPage extends StatefulWidget {
  const ButtonListPage({super.key});

  @override
  State<StatefulWidget> createState() {
    return ButtonListPageState();
  }
}

class ButtonListPageState extends State with SingleTickerProviderStateMixin {
  late AnimationController _controller;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    _controller = AnimationController(vsync: this)
      ..drive(Tween(begin: 0, end: 1))
      ..duration = Duration(milliseconds: 500);
  }

  @override
  Widget build(BuildContext context) {

    int b = 96;
    return Scaffold(
      appBar: AppBar(
        title: const Text("ButtonList "),
      ),
      body: SizedBox.expand(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text("${true ? 'a' : b}"),
            Text("${true ? 'a' : 96}"),
            ElevatedButton(
              onPressed: () {
                debugPrint("---");
              },
              child: const Text("ElevatedButton 按钮"),
            ),
            const SizedBox(height: 40),
            OutlinedButton(
              onPressed: () {
                debugPrint("---");
              },
              child: const Text("OutlinedButton 按钮"),
            ),
            const SizedBox(height: 40),
            TextButton(
              onPressed: () {
                debugPrint("---");
              },
              child: const Text("TextButton 按钮"),
            ),
            const SizedBox(height: 40),
            IconButton(onPressed: () {}, icon: Icon(Icons.add)),
            const SizedBox(height: 40),
            InkWell(
              child: AnimatedIcon(
                icon: AnimatedIcons.pause_play,
                progress: _controller,
              ),
              onTap: () {
                if (_controller.status == AnimationStatus.completed) {
                  _controller.reverse();
                } else if (_controller.status == AnimationStatus.dismissed) {
                  _controller.forward();
                }
              },
            )
          ],
        ),
      ),
    );
  }
}
